/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
package org.apache.curator.framework.state;

/**
 * 连接到zk的状态变化
 */
public enum ConnectionState {
    /**
     * 成功连接ZK，一个CuratorFramework实例只会收到一条连接信息
     */
    CONNECTED,

    /**
     * 中间状态，处于失去zk连接状态，leader，locks等挂起，直到重连成功，如果连接超时将收到Lost通知
     */
    SUSPENDED,

    /**
     * 重新建立挂起和只读连接
     */
    RECONNECTED,

    /**
     * 连接断开，释放锁，leaders等
     */
    LOST,

    /**
     * 连接进入只读模式，，通过设置 CuratorFrameworkFactory.Builder#canBeReadOnly() 才发出现这种情况。
     * 官方连接 ： http://wiki.apache.org/hadoop/ZooKeeper/GSoCReadOnlyMode
     * 在发送另一个状态更改之前，连接将保持只读模式。
     */
    READ_ONLY
}
